#include "NegativeProcessor.h"

#include <QDebug>

NegativeProcessor::NegativeProcessor()
{
}

void NegativeProcessor::preRender()
{
    qDebug() << "Negative prerender";

}

void NegativeProcessor::apply()
{
    qDebug() << "Negative apply";


    GLfloat invertMap[256];
    invertMap[0] = 1.0f;
    for(int i = 1; i < 256; i++) {
        invertMap[i] = 1.0f - (1.0f / 255.0f * (GLfloat)i);
    }
    glPixelMapfv(GL_PIXEL_MAP_R_TO_R, 255, invertMap);
    glPixelMapfv(GL_PIXEL_MAP_G_TO_G, 255, invertMap);
    glPixelMapfv(GL_PIXEL_MAP_B_TO_B, 255, invertMap);
    glPixelTransferi(GL_MAP_COLOR, GL_TRUE);

}
